{extend name="layout/layout" /}

{block name="pagecss"}
<style>
	input[type="checkbox"]{
		margin-left: 8px;
	}
	input[type="radio"]{
		margin-left: 8px;
	}
	.operator{
		display: none;
	}
	.form-horizontal .pro_type label {
	    font-size: 13px;
	    color: #999999;
	    line-height: 34px;
	    text-align: center;
	    display: inline-block;
	    position: relative;
	    margin: 0 10px 15px 0;
	    border: solid 1px #c2cad8;
	    padding: 7px 22px;
	    line-height: 1.44;
	}
	.form-horizontal .pro_type input[type="checkbox"]{appearance: none;-webkit-appearance: none;}
	.form-horizontal .pro_type input[type="checkbox"]:checked{}
	.form-horizontal .pro_type label.active,.form-horizontal .pro_type label:hover{border: solid 1px #33CC66;background: #33CC66;color: #fff;}
	.form-horizontal .radio-inline.xf_tip{display: none;padding-top: 0;}
</style>
{/block}

{block name="content"}
<div class="row">
	<div class="col-xs-12">
		<div class="box box-success">
			<div class="box-header with-border">
				<h3 class="box-title">店员编辑</h3>
				<div class="box-tools">
					<!--<button class="btn bg-navy btn-sm" data-toggle="tooltip" title="" data-original-title="Back" onclick="history.go(-1);">
                        <i class="fa fa-reply"></i> 返回
                    </button>-->
				</div>
			</div>
			<div id="modal_new_role" class="box-body">
				<form id="operator_form" class="form-horizontal form validation-form" method="post" enctype="multipart/form-data">
					{:token()}
					<div class="form-body">
						<div class="form-group">
							<lable class="col-md-2 control-label"><span class="required">*</span>用户账号：</lable>
							<div class="col-md-6">
								<input type="text" class="form-control input-xlarge" value="{$row.loginName}" disabled name="loginName" maxlength="50" placeholder="" onkeyup="this.value=this.value.replace(/[^\w]/g,'')" onpaste="this.value=this.value.replace(/[^\w]/g,'')">
							</div>
						</div>
						<div class="form-group">
							<lable class="col-md-2 control-label"><span class="required">*</span>姓名：</lable>
							<div class="col-md-6">
								<input type="text" class="form-control input-xlarge" value="{$row.name}" name="name" maxlength="50" placeholder="请填员工姓名">
							</div>
						</div>

						<div class="form-group">
							<lable class="col-md-2 control-label"><span class="required">* </span>手机号：</lable>
							<div class="col-md-6">
								<input type="text" class="form-control input-medium" value="{$row.phone}" name="phone" maxlength="40" placeholder="请输入联系电话" onkeyup="this.value=this.value.replace(/[^\d_-]/g,'') " onafterpaste="this.value=this.value.replace(/[^\d_-]/g,'')"><span style="display: none;">用于接收系统发送的订单、售后通知</span>
							</div>
						</div>

						<div class="form-group">
							<lable class="col-md-2 control-label">密码：</lable>
							<div class="col-md-6">
								<input type="password" class="form-control input-medium" value="" name="pass_one" maxlength="40" placeholder="修改密码时填写此项，若不修改则不填">
							</div>
						</div>

						<div class="form-group">
							<lable class="col-md-2 control-label">确认密码：</lable>
							<div class="col-md-6">
								<input type="password" class="form-control input-medium" value="" name="pass_tow" maxlength="40" placeholder="修改密码时填写此项，若不修改则不填">
							</div>
						</div>

						<div class="form-group">
							<lable class="col-md-2 control-label"><span class="required">* </span>角色</lable>
							<div class="col-md-6">
								<input type="radio" {eq name="row.roleType" value="1"} checked {/eq}  name="roleType" value="1" >管理员
								<input type="radio" {eq name="row.roleType" value="2"} checked {/eq} name="roleType" value="2" >店员
							</div>
						</div>

						<div class="form-group operator">
							<lable class="col-md-2 control-label"><span class="required">* </span>门店</lable>
							<div class="col-md-6">
								{if condition="$admin.roleType == 2 "}
                                <input type="hidden" name="storeId" value="{$admin.storeId}">
                                <select class="form-control" name="storeId" disabled>
									<option value="">请选择</option>
									{volist name="list" id="vo"}
									<option {eq name="vo.id" value="$admin.storeId"} selected {/eq} value="{$vo.id}">{$vo.name}</option>
									{/volist}
								</select>
                                {else /}
								<select class="form-control" name="storeId">
									<option value="">请选择</option>
									{volist name="list" id="vo"}
									<option {eq name="vo.id" value="$row.storeId"} selected {/eq} value="{$vo.id}">{$vo.name}</option>
									{/volist}
								</select>
								{/if}
							</div>
						</div>

						<div class="form-group operator">
							<lable class="col-md-2 control-label">选择权限：</lable>
							<div class="col-md-6 data pro_type">
								{volist name="module" id="vo"}
									{if condition="$vo['isRoleSet'] === 0 "}
									<span style="display: none"><input type="checkbox" name="moduleIds" value="{$vo.id}" checked="checked"></span>
									{else}
									<label class='btn btn-default checkbox-inline margin-bottom {in name="vo.id" value="$row.moduleIds"}active{/in} ' ><input type="checkbox" name="moduleIds"  {in name="vo.id" value="$row.moduleIds"}checked{/in} value="{$vo.id}" style='position: relative !important; padding: 0;margin: 0;' >{$vo.name}</label>
									{/if}
								{/volist}
							</div>
						</div>

						<input type="hidden" name="id" value="{$row.id}">
						<hr />

						<div class="form-actions">
							<div class="row">
								<div class="col-md-12">
									<div class="form-group">
										<label class="col-md-3 control-label"></label>
										<div class="col-md-9">
											<button type="button" class="btn btn-primary" id="modal_sure_new">
												保存 <i class="fa fa-floppy-o"></i>
											</button>
											<button type="button" class="btn btn-default" onclick="history.go(-1);">
												返回 <i class="fa fa-mail-forward"></i>
											</button>
											<div class="help-block " style="color:red"></div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
{/block}

{block name="pagescript"}
<script>
    var post_url = "{:url('admin/operator/editPost')}";
    var index_url = "{:url('admin/operator/index')}";
    var isAdd = false;

    function beback(){
        window.location.href = index_url;
    }
    
</script>
<script src="__STATIC__/admin/pages/js/operator.js" type="text/javascript"></script>
{/block}